<template>
  <div class="login-container">
    <div class="login-box">
      <div class="login-left">
        <img src="@/assets/image/login/allipayIcon.png" />
      </div>
      <div class="login-form">
        <div class="login-title">
          <img class="icon" src="@/assets/jpay.jpg" alt="logo" />
          <h2 class="title">合作方管理平台</h2>
        </div>
        <LoginForm />
        <SwitchDark />
        <div>测试：{{ t('common.text') }}</div>
        <el-select v-model="lang" placeholder="请选择" @change="changLang">
          <el-option label="中文" value="cn"></el-option>
          <el-option label="English" value="en"></el-option>
          <el-option label="繁体" value="zh"></el-option>
        </el-select>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
  import LoginForm from './components/LoginForm.vue'
  import SwitchDark from '@/components/SwitchDark/index.vue'
  import { useI18n } from 'vue-i18n'
  import { useGlobalSettingStore } from '@/store/modules/globalSetting'
  import { testAPI, testPAPI, testPAPI2, testMock } from '@/api'
  const { t, locale } = useI18n()
  const lang = ref(useGlobalSettingStore().getLangConfig() || 'cn')
  const changLang = (val: string) => {
    locale.value = val
    useGlobalSettingStore().setLangConfig(val)
  }
  // testAPI({name: "user",age: 18,email: '123@qq.com'}).then(res=> {
  //   console.log(res)
  // }).catch(err => {
  //   // console.log(err)
  // })
  // testPAPI({ name: 'user', age: 18, email: '123@qq.com' })
  //   .then((res) => {
  //     console.log(res)
  //   })
  //   .catch((err) => {
  //     // console.log(err)
  //   })
  // testPAPI2({name: "user",age: 18,email: '123@qq.com'}).then(res=> {
  //   console.log(res)
  // }).catch(err => {
  //   // console.log(err)
  // })
  testMock({ name: 'user', age: 18, email: '123@qq.com' })
    .then((res) => {
      console.log(res)
    })
    .catch((err) => {
      // console.log(err)
    })
</script>
<style lang="scss" scoped>
  @import './index';
</style>
